<html>
<head><meta charset="utf-8"><title>upvar ananlysis · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/upvar.20ananlysis.html">upvar ananlysis</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203782702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/upvar%20ananlysis/near/203782702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/upvar.20ananlysis.html#203782702">(Jul 13 2020 at 23:13)</a>:</h4>
<p>When we call expr use visitor <a href="https://github.com/rust-lang/rust/blob/a88182f94b0141a8df54fe86aad07d857baff911/src/librustc_typeck/check/upvar.rs#L157">here</a></p>
<p>It will call the Delegate with consume/borrow/mutate for all variables (upvars and local variables) and build this <a href="https://github.com/rust-lang/rust/blob/a88182f94b0141a8df54fe86aad07d857baff911/src/librustc_typeck/check/upvar.rs#L155">map</a> for all places that are mutated or consumed.</p>
<p>If I understand the code correctly, this information about the local variables will get <a href="https://github.com/rust-lang/rust/blob/a88182f94b0141a8df54fe86aad07d857baff911/src/librustc_typeck/check/upvar.rs#L179">populated</a>  into the typechk tables. <br>
<a href="https://github.com/rust-lang/rust/blob/a88182f94b0141a8df54fe86aad07d857baff911/src/librustc_typeck/check/writeback.rs#L326">Writeback</a> doesn't filter them out either.</p>
<p>Is there a specific reason for doing so? Is it because the caller will probably be checking closure_captures before reading capture kind</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>